/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.asistente.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Wizard
 */
@Entity
@Table(name = "hd_detalle_ticket")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "HdDetalleTicket.findAll", query = "SELECT h FROM HdDetalleTicket h"),
    @NamedQuery(name = "HdDetalleTicket.findByCodTicket", query = "SELECT h FROM HdDetalleTicket h WHERE h.hdDetalleTicketPK.codTicket = :codTicket"),
    @NamedQuery(name = "HdDetalleTicket.findByCodDetTicket", query = "SELECT h FROM HdDetalleTicket h WHERE h.hdDetalleTicketPK.codDetTicket = :codDetTicket"),
    @NamedQuery(name = "HdDetalleTicket.findByFecAsignacion", query = "SELECT h FROM HdDetalleTicket h WHERE h.fecAsignacion = :fecAsignacion")})
public class HdDetalleTicket implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected HdDetalleTicketPK hdDetalleTicketPK;
    @Column(name = "FEC_ASIGNACION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecAsignacion;
    @JoinColumn(name = "COD_TECNICO", referencedColumnName = "COD_TECNICO")
    @ManyToOne(fetch = FetchType.LAZY)
    private HdTecnicos codTecnico;
    @JoinColumn(name = "COD_TICKET", referencedColumnName = "COD_TICKET", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private HdTickets hdTickets;

    public HdDetalleTicket() {
    }

    public HdDetalleTicket(HdDetalleTicketPK hdDetalleTicketPK) {
        this.hdDetalleTicketPK = hdDetalleTicketPK;
    }

    public HdDetalleTicket(int codTicket, int codDetTicket) {
        this.hdDetalleTicketPK = new HdDetalleTicketPK(codTicket, codDetTicket);
    }

    public HdDetalleTicketPK getHdDetalleTicketPK() {
        return hdDetalleTicketPK;
    }

    public void setHdDetalleTicketPK(HdDetalleTicketPK hdDetalleTicketPK) {
        this.hdDetalleTicketPK = hdDetalleTicketPK;
    }

    public Date getFecAsignacion() {
        return fecAsignacion;
    }

    public void setFecAsignacion(Date fecAsignacion) {
        this.fecAsignacion = fecAsignacion;
    }

    public HdTecnicos getCodTecnico() {
        return codTecnico;
    }

    public void setCodTecnico(HdTecnicos codTecnico) {
        this.codTecnico = codTecnico;
    }

    public HdTickets getHdTickets() {
        return hdTickets;
    }

    public void setHdTickets(HdTickets hdTickets) {
        this.hdTickets = hdTickets;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (hdDetalleTicketPK != null ? hdDetalleTicketPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof HdDetalleTicket)) {
            return false;
        }
        HdDetalleTicket other = (HdDetalleTicket) object;
        if ((this.hdDetalleTicketPK == null && other.hdDetalleTicketPK != null) || (this.hdDetalleTicketPK != null && !this.hdDetalleTicketPK.equals(other.hdDetalleTicketPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.asistente.DAO.HdDetalleTicket[ hdDetalleTicketPK=" + hdDetalleTicketPK + " ]";
    }
    
}
